package com.listener;

import com.alibaba.otter.canal.protocol.CanalEntry;
import com.xpand.starter.canal.annotation.*;
import lombok.extern.slf4j.Slf4j;

/**
 * @author mengdexuan on 2018/7/6 11:48.
 */
@CanalEventListener
@Slf4j
public class MyEventListener {

	@InsertListenPoint
	public void onEvent(CanalEntry.EventType eventType, CanalEntry.RowData rowData) {
		log.info(rowData.toString());
	}


	@UpdateListenPoint
	public void onEvent1(CanalEntry.RowData rowData) {
		//do something...
		System.out.println(rowData.toString());
	}

	@DeleteListenPoint
	public void onEvent3(CanalEntry.EventType eventType) {
		//do something...
		System.out.println(eventType.toString());
	}

	@ListenPoint(destination = "example", schema = "test", table = {"person", "test"}, eventType = CanalEntry.EventType.UPDATE)
	public void onEvent4(CanalEntry.EventType eventType, CanalEntry.RowData rowData) {
		//do something...
		System.out.println(eventType.toString());
	}

}
